//
//  Swift+LL.swift
//  NCFinance
//
//  Created by 田玉城 on 2020/4/26.
//  Copyright © 2020 cn.com.cnfic.www. All rights reserved.
//

import Foundation
import UIKit

/// 类型协议
public protocol LLSwiftThemeWrapperProtocol {
    associatedtype LLSwiftThemeWrapperType ///泛型
    var themeWrappedValue: LLSwiftThemeWrapperType { get }
    init(value: LLSwiftThemeWrapperType)
}
/// 泛型实现协议
public struct LLSwiftThemeNamespaceWrapper<Base>: LLSwiftThemeWrapperProtocol {
    public let themeWrappedValue: Base
    public init(value: Base) {
        self.themeWrappedValue = value
    }
}


/// 命名空间协议
public protocol LLSwiftThemeNamespaceWrappable {
    associatedtype LLSwiftWrapperType
    var theme: LLSwiftWrapperType { get }
    static var theme: LLSwiftWrapperType.Type { get }
}

public extension LLSwiftThemeNamespaceWrappable {
    /// 实体类调用
    var theme: LLSwiftThemeNamespaceWrapper<Self> {
        return LLSwiftThemeNamespaceWrapper(value: self)
    }
    ///静态调用
    static var theme: LLSwiftThemeNamespaceWrapper<Self>.Type {
        return LLSwiftThemeNamespaceWrapper.self
    }
}




/// 定义
extension UIApplication : LLSwiftThemeNamespaceWrappable {}
extension UIViewController : LLSwiftThemeNamespaceWrappable {}
extension String : LLSwiftThemeNamespaceWrappable {}
extension Date : LLSwiftThemeNamespaceWrappable {}
extension UIView: LLSwiftThemeNamespaceWrappable {}
extension UIImage: LLSwiftThemeNamespaceWrappable {}
extension CGFloat: LLSwiftThemeNamespaceWrappable {}
extension Double: LLSwiftThemeNamespaceWrappable {}
extension UIScreen: LLSwiftThemeNamespaceWrappable {}
